def call(String lockFile, int loopCount, int sleepSeconds) {
    script {
        boolean result = false
        for (int i = 0; i < loopCount; i++) {
            boolean fe = fileExists file: lockFile
            if (fe) {
                sleep sleepSeconds
            } else {
                try {
                    File file = new File(lockFile)
                    createNewFile = file.createNewFile()
                    echo "createNewFile: ${createNewFile}"
                    if (createNewFile) {
                        // writeFile file: lockFile, text: "${env.BUILD_VERSION}"
                        file.write "${env.BUILD_VERSION}"
                        result = true
                        break
                    }
                } catch (e) {
                    echo "e: ${e}"
                    break
                }
            }
        }
        return result
    }
}